package network;
import game.Game;
import game.controlling.KeyListener;
import game.objects.GOComplex;
import graphics.objects.GraphicsObject;
import graphics.system.Color;
import graphics.system.GLTools;
import graphics.system.Renderer;
import graphics.tools.Console;

import network.protocol.ClientHandler;
import network.protocol.ServerHandler;

import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;

import physics.Body;
import tools.Point;
public class NetworkTesterRenderer extends Renderer {
	private boolean showConsole = false;
	Game gameServer, gameClient;
	KeyListener keyListener;
	int frame = 0;
	ServerHandler server;
	ClientHandler client;
	private boolean simplerender;
	@Override
	public void render() {
	}
	/*
	 * public NetworkTesterRenderer() { keyListener = new KeyListener(); server = new ServerHandler(); client = new ClientHandler(); gameServer = new Game(server); gameServer.setKeyListener(keyListener); // This kinda sucks. gameServer.engine.graphics.setRenderer(this); // This is ok again. gameServer.initialize(); DummySocket socketOnClient = new DummySocket(); DummySocket socketOnServer = new DummySocket(); // Connect them socketOnClient.setOtherSocket(socketOnServer); socketOnServer.setOtherSocket(socketOnClient); client.setServer(socketOnClient); server.addClient(socketOnServer); client.initialize(); gameClient = client.getGame(); gameClient.setKeyListener(keyListener); gameClient.engine.graphics.setRenderer(this); }
	 * 
	 * public void handle() { frame++; super.handleGraphicLogic(); gameServer.handle(); gameClient.handle(); control(); if (frame % 30 == 0 && frame < 270) { GOComplex c = new GOComplex(gameServer, new Point(305, 500)); gameServer.addGameObject(c); } }
	 * 
	 * @Override public void render() { // Always render simple GL11.glClearColor(0.5f, 0.5f, 0.5f, 1); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); this.renderAllColor(); if (showConsole) { Console.draw(); } drawSyncDifference(); }
	 * 
	 * private void control() { while (Keyboard.next()) { keyListener.addKey(Keyboard.getEventKey(), Keyboard.getEventKeyState()); if (Keyboard.getEventKey() == Keyboard.KEY_F9 && !Keyboard.getEventKeyState()) { showConsole = !showConsole; } if (Keyboard.getEventKey() == Keyboard.KEY_F10 && !Keyboard.getEventKeyState()) { simplerender = !simplerender; } } while (Mouse.next()) { keyListener.addButton(Mouse.getEventButton(), Mouse.getEventButtonState()); } if (Mouse.isButtonDown(0)) { keyListener.setMouseX(Mouse.getX()); keyListener.setMouseY(Mouse.getY()); } }
	 * 
	 * public void drawSyncDifference() { // uglyDrawOnlyClient(false); Body b1, b2; for (int i = 0; i < gameClient.engine.world.numBodies; i++) { b1 = gameClient.engine.world.getBody(i); if (gameServer.engine.world.containsBodyId(b1.id)) { b2 = gameServer.engine.world.getBodyById(b1.id); GLTools.drawLine(b1.pos, b2.pos, new Color()); } // GLTools.drawCircle(b1.pos, 5, 0.0f, new Color(255, 0, 0, 0.5f)); } gameClient.engine.world.helpDraw(); }
	 * 
	 * public void uglyDrawOnlyClient(boolean delete) { GraphicsObject remove = null; for (GraphicsObject o : this.objects) { for (int i = 0; i < gameServer.engine.graphics.numGraphicsObjects; i++) { GraphicsObject g = gameServer.engine.graphics .getGraphicsObject(i); if (g == o) { if (delete) { remove = o; } else { g.color = new Color(g.color.r, g.color.g, g.color.b, 0.1f); } } } } if (remove != null) removeObject(remove); }
	 * 
	 * public void initialize() { super.initializeGraphicsSystem(); }
	 */
}
